package com.project.base.baseproject.AppCustoms.Tool;

import java.util.Calendar;

/**
 * Created by mac on 2017/5/22.
 */
//日程相关操作
public class CalendarTool {
    //得到今天是本周的周几 因为默认一周第一天是周日，所以需要转换
    public static String getDayOfWeek(Calendar calendar) {
        String dayOfWeek = "";
        if(calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
            dayOfWeek = "日";
        }
        if(calendar.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) {
            dayOfWeek = "一";
        }
        if(calendar.get(Calendar.DAY_OF_WEEK) == Calendar.TUESDAY) {
            dayOfWeek = "二";
        }
        if(calendar.get(Calendar.DAY_OF_WEEK) == Calendar.WEDNESDAY) {
            dayOfWeek = "三";
        }
        if(calendar.get(Calendar.DAY_OF_WEEK) == Calendar.THURSDAY) {
            dayOfWeek = "四";
        }
        if(calendar.get(Calendar.DAY_OF_WEEK) == Calendar.FRIDAY) {
            dayOfWeek = "五";
        }
        if(calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY) {
            dayOfWeek = "六";
        }
        return dayOfWeek;
    }
}
